<template>
  <div>
    <!-- 画图必须给具体宽高画板 -->
    <div id="mysell" style="width:100%;height:450px;">
    </div>
  </div>
</template>

<script>
import * as echarts from "echarts"
export default {
  mounted() {
    this.initEchart()
  },
  methods: {
    initEchart() {
      var mychart = echarts.init(document.getElementById('mysell'))
      mychart.setOption({
        title: {
          text: '本周药品销售排行榜',
          textStyle:{
            color:'#666ee8',
          },
          subtext: '划入查看名称',
          left: 'center'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
          left: 'center',
          top: 'bottom',
          data: [
            '兰索拉唑肠溶片',
            '甲钴胺片',
            '复方求唑沙宗胶囊',
            '对乙酰氨基酚片',
            '双嘧达莫片',
            '阿莫西林胶囊',
            '骨肽注射液',
            '红霉素眼膏'
          ]
        },
        toolbox: {
          show: true,
          feature: {
            mark: { show: true },
            dataView: { show: true, readOnly: false },
            restore: { show: true },
            saveAsImage: { show: true }
          }
        },
        series: [
          {
            name: '销售数据',
            type: 'pie',
            radius: [20, 140],
            center: ['50%', '50%'],
            roseType: 'radius',
            itemStyle: {
              borderRadius: 5
            },
            label: {
              show: false
            },
            emphasis: {
              label: {
                show: true
              }
            },
            data: [
              { value: 400, name: '兰索拉唑肠溶片' },
              { value: 330, name: '甲钴胺片' },
              { value: 280, name: '复方求唑沙宗胶囊' },
              { value: 220, name: '对乙酰氨基酚片' },
              { value: 200, name: '双嘧达莫片' },
              { value: 150, name: '阿莫西林胶囊' },
              { value: 120, name: '骨肽注射液' },
              { value: 100, name: '红霉素眼膏' }
            ]
          }
        ]
      })//参数是配置项
    }
  },

}
</script>

<style>
/* #id{
  width:100%;
  min-height: 450px;
} */
</style>